<?php

class CyclicGraph extends Graph
{
	protected $type = 2;
	
	protected function generateMatrix()
	{
		$numberOfVertices = count($this->vertices);
		for ($i = 1; $i <= $numberOfVertices; $i++)
		{
			for ($j = $i; $j <= $numberOfVertices; $j++)
			{
				if ($j == $i + 1 || ($i == 1 && $j == $numberOfVertices))
				{
					$edge = 1;
				}
				else
				{
					$edge = 0;
				}
				
				if ($edge) {
					$this->matrix[$i][$j] = $edge;
					$this->matrix[$j][$i] = $edge;
				}
			}
		}
	}
}